//router.js
var fs = require('fs');
function router(pathname){
	if(pathname == "/Node01"){
		return fs.readFileSync("Node_Web_01.html", "utf8");
/*		setTimeout(function(){
			return "<h1>Welcome to My first Page";
		},5000);
		console.log("堵塞5秒");*/
	}else if(pathname == "/Node02"){
		// fs.readFile("Node_Web_02.html", "utf8",function(err,data){
		// 	if(err){
		// 		console.log("Error:" + err);
		// 	}else{
		// 		return data;
		// 	}
		// });
		return "<h1>Welcome to My second Page";
	}else if(pathname == "/Node03"){
/*		fs.readFile("Node_Web_03.html", "utf8",function(err,data){
			if(err){
				console.log("Error:" + err);
			}else{
				return data;
			}
		});*/
		return "<h1>Welcome to My third Page";
	}else{
		return "<h1>404 NOT FOUND</h1>";
	}
}

exports.router = router;